<template>
  <div>
    <div class="create-form">
      <input type="text" v-model="content" placeholder="请输入代办事项" />
      <button @click="handleClick">完成</button>
    </div>
  </div>
</template>

<script>
export default {
  props: ['todo'],
  data() {
    return {
      content: '',
    }
  },
  mounted() {
    this.content = this.todo.content
  },
  methods: {
    handleClick() {
      this.$emit('editTodo', this.todo.id, this.content)
    },
  },
}
</script>

<style lang="scss" scoped>
.create-form {
  width: 100%;
  height: 40px;
  margin: 25px 0;

  display: flex;
  border: 1px solid #3636cc;
  button {
    border: none;
    width: 50px;
    height: 100%;
    background-color: #3b36cc;
    color: white;
  }
}
.create-form > input {
  border: none;
  outline: none;
  background: none;
  width: 100%;
  height: 40px;
  color: white;
  margin-left: 20px;
}
</style>